import 'package:audioplayers/audioplayers.dart';
import 'package:music_player/http/api.dart';

class MusicService{

  static final AudioPlayer _player = AudioPlayer();

  static void play() async{

    await _player.play(UrlSource(Api.MUSIC_URL));

    Duration _totalDuration = Duration.zero;
    Duration _currentPosition = Duration.zero;

    final d = await _player.getDuration();
    print(d);
   /* _player.onDurationChanged.listen((Duration duration) {
        _totalDuration = duration;
        print("onDurationChanged:$duration");
    });

    _player.onPositionChanged.listen((Duration duration) {
      _currentPosition = duration;
      print("onPositionChanged:$duration");
    });
*/

  }

  static void stop() async{

  }

  static void pause() async{
    await _player.pause();
  }



}